from django.db import models

'''
模型class  Meta属性详解：
https://blog.csdn.net/weixin_30410119/article/details/99028346?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&dist_request_id=1328680.10052.16161377106022449&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control
'''

class ModelBase(models.Model):
    """
    模型基类
    """

    id = models.BigAutoField(primary_key=True)
    joined_time = models.DateTimeField(auto_now_add=True, verbose_name="加入时间")
    update_time = models.DateTimeField(verbose_name="更新时间", blank=True, null=True)

    class Meta:
        abstract = True

    # 格式化初始参数
    @classmethod
    def format_request_data(cls, data):
        return data